from odoo import api, fields, models

CATEGORY_TYPE = [('L1', '一级'), ('L2', '二级')]


class RpFlowRecordCategory(models.Model):
    _name = 'rp.flow.record.category'
    _description = '流水记录类型'

    name = fields.Char(string='名称', required=True, copy=False, index=True)
    category_type = fields.Selection(string='分类', required=True, selection=CATEGORY_TYPE)
    parent_category_id = fields.Many2one(string='上级类型', comodel_name='rp.flow.record.category', copy=False)
    validate_flag = fields.Boolean(string='有效标志', default=True, copy=False, index=True)
    create_date = fields.Datetime(string='创建时间', default=fields.datetime.now(), copy=False, index=True)
    desc = fields.Char(string='描述', copy=False)
